<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let str = "a3c1a432aa4";

      // console.log(str.match(/a\d/));
      console.log(str.match(/^a\d/)); // ^匹配开始位置
      console.log(str.match(/a\d$/)); // $匹配结束位置
    </script>
  </body>
</html>
